home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Games of Daze
/
Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso
/
x2ftp
/
msdos
/
source
/
gfxfx
/
fastmath.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1994-06-22
|
807b
|
34 lines
unit fastmath;
{ approximatly-20%-faster-sin-cos-and-other-giometrical-stuff unit }
{ made by Bas van Gaalen, Holland, PD }
{ uh, not finished... }
interface
const divd = 1024;
{ input: 0 <= arc <= 359, output: -divs <= sinus(arc) <= divd }
function sinus(_arc : word) : integer;
{ input: 0 <= arc <= 359, output: -divs <= cosin(arc) <= divd }
function cosin(_arc : word) : integer;
implementation
type stype = array[0..359] of integer;
var stab : stype;
procedure calcsin(var st : stype); var i : word; begin
for i := 0 to 359 do st[i] := round(sin(2*pi*i/360)*divd); end;
function sinus(_arc : word) : integer; begin
sinus := stab[_arc]; end;
function cosin(_arc : word) : integer; begin
cosin := stab[(_arc+90) mod 360]; end;
begin
calcsin(stab);
end.